package com.csr.csrcheck.controller;

import com.csr.csrcheck.controller.ex.CompanyException;
import com.csr.csrcheck.service.Important_notificationService;
import com.csr.csrcheck.util.JsonResult;
import com.csr.csrcheck.util.PageResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping({"important_notific"})
public class Important_notificationController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(com.csr.csrcheck.controller.Important_notificationController.class);

    @Resource
    private Important_notificationService important_notificationService;

    @RequestMapping({"important"})
    public JsonResult<Object> important(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "5") int pageSize, String product_name, String product_t_name) {
        PageResult pageResult = this.important_notificationService.getimportant_page(pageNum, pageSize, product_name, product_t_name);
        if (pageResult == null)
            throw new CompanyException("");
                    log.info("important----------------------------->pageNum:" + pageNum);
        log.info("important----------------------------->pageSize:" + pageSize);
        log.info("important----------------------------->product_name:" + product_name);
        log.info("important----------------------------->product_t_name:" + product_t_name);
        return new JsonResult(Integer.valueOf(0), "json", pageResult);
    }
}
